package com.example.dao;

import com.example.entity.CarEntity;
import com.example.interceptor.CarsPage;
import com.example.interceptor.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;

@Repository
public interface CarDao {
    void insertCar(CarEntity carEntity);
    //@Select("SELECT car.date,  price, boot_id FROM car where id > #{id} limit 1")注解和xml不能一起用，会抛异常
    CarEntity getCar(long id);
    //可以判断是否存在bootid，若有则不能删除，抛出捕获的异常
    void deleteCar(long id);
    void deleteCarByBootId(int bootId);
    int getTotal();

    //List<CarEntity> getCarS();
    List<CarEntity> getCarS(@Param("page") Page page);
    //List<CarEntity> getCarSByName(@Param("page") Page page,@Param("price") BigDecimal name);
    CarsPage getCarSByName(@Param("page") Page page, @Param("price") BigDecimal name);

}
